package com.gxa.client_shoppings.service.impl;

import com.gxa.client_shoppings.mapper.SendTypeMapper;
import com.gxa.client_shoppings.pojo.SendType;
import com.gxa.client_shoppings.service.SendTypeService;
import com.gxa.client_shoppings.utils.JsonResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author smile_ZhongXuan
 * @Date 2020/11/16 15:28
 * @Version 1.0
 */
@Service("sendTypeService")
public class SendTypeServiceImpl implements SendTypeService {

    @Resource
    SendTypeMapper sendTypeMapper = null;
    JsonResult jsonResult = new JsonResult();

    @Override
    public Integer sendTypeAdd(SendType sendType) {
        return sendTypeMapper.insertSelective(sendType);
    }

    @Override
    public Integer sendTypeUpdate(SendType sendType) {
        return sendTypeMapper.updateByPrimaryKeySelective(sendType);
    }

    @Override
    public Integer sendTypeState(Integer id, Boolean state) {
        SendType sendType = new SendType();
        sendType.setId(id);
        sendType.setState(state);
        return sendTypeMapper.updateByPrimaryKeySelective(sendType);
    }

    @Override
    public List<SendType> sendTypeList() {
        return sendTypeMapper.selectAll();
    }
}
